package cn.b.sky.schedule.service.impl;

import cn.b.sky.schedule.dao.TestJobDao;
import cn.b.sky.schedule.model.TestJobVo;
import cn.b.sky.schedule.service.TestJobService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.net.InetAddress;

@Service("testJobService")
public class TestJobServiceImpl implements TestJobService {

  private static final Logger LOGGER = LoggerFactory.getLogger(TestJobServiceImpl.class);

  @Resource
  private TestJobDao testJobDao;

  @Override
  public void execute() {
    //System.out.println("Job executing...");
  }

  @Override
  public void insertTestJob(TestJobVo vo) {
    try {
      InetAddress addr = InetAddress.getLocalHost();
      vo.setServAddr(addr.getHostAddress());
      testJobDao.insertTestJob(vo);
    } catch (Exception e) {
      //  Auto-generated catch block
      LOGGER.error("{}", e);
    }

  }
}
